<?php 

    $conn = oci_connect("hospital", "hospital", "//localhost/XE"); 
	$pull = oci_parse($conn, "select * from medications 
			where med_id = '$_GET[id]'");
	oci_execute($pull);

        $patid = oci_fetch_array($pull,OCI_BOTH);
        
       // echo $patid['PATIENT_ID'];
        $p = $patid['PATIENT_ID'];
        
        if($p!=null){
           $delpa = oci_parse($conn, "delete from patients where id = '$p'");
           oci_execute($delpa); 
        }
           $del1 = oci_parse($conn, "delete from medications where MEDICATION_ID = '$_GET[id]'");
           oci_execute($del1);

           
 ?>
 
 <HTML>
 <head><meta http-equiv="refresh" content="1; URL=main.php"></head>
<BODY>
 Going Back to the table
 </BODY>
 </HTML>

